package com.ww.testclient.order;

//import com.netflix.loadbalancer.ILoadBalancer;
//import com.netflix.loadbalancer.Server;

import lombok.Data;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.Serializable;


@RestController
@Data
@RequestMapping
public class TestController implements Serializable {

//    @Autowired
//    private TestService testService;

//    @Autowired
//    SpringClientFactory springClientFactory;
//    @Autowired
//    LoadBalancerClient loadBalancerClient;
//    @Autowired
//    ILoadBalancer iLoadBalancer;

//    @GetMapping("/test/get/str")
//    public String getRequestStr(@RequestParam("str") String str) {
//        System.out.println(iLoadBalancer);
//        ILoadBalancer loadBalancer = springClientFactory.getLoadBalancer("test-service-rpc");
//        List<Server> allServers = loadBalancer.getAllServers();
//        Server server = loadBalancer.chooseServer(null);
//        ServiceInstance choose = loadBalancerClient.choose("test-service-rpc");
//        System.out.println(choose.getPort());
//        for (int i = 1; i < 10; i++) {
//            rpcController.getRequestStr(str);
//        }
//        List<Server> allServers = iLoadBalancer.getAllServers();
//        ILoadBalancer loadBalancer = springClientFactory.getLoadBalancer("test-service-rpc");
//        Server server = loadBalancer.chooseServer("test-service-rpc");
//        return rpcController.getRequestStr(str).addlistener();
//        return rpcController.getRequestStr(str);
//    }

}
